#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

#include <openssl/md5.h>
#include <openssl/evp.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
#include <openssl/err.h>
#include <openssl/pem.h>

int32_t
dd_base64_encode(uint8_t *in, uint32_t inl, uint8_t * out);

int32_t
dd_base64_decode(uint8_t *in, uint32_t inl, uint8_t *out);

int32_t
dd_sign_with_rsa(uint8_t * in, uint32_t inl, uint8_t * out, EVP_MD *type, EVP_PKEY* key);

EVP_PKEY *
dd_get_rsa_PKCS1_key(uint8_t * in, uint32_t inl, int private);

RSA *
dd_get_rsa_key(uint8_t * in, uint32_t inl, int private);